package com.wang.springbootinit.controller.teacher;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wang.springbootinit.common.BaseResponse;
import com.wang.springbootinit.common.ResultUtils;
import com.wang.springbootinit.model.vo.AnswerAnalyzeDataVO;
import com.wang.springbootinit.model.vo.AnswerRecordVO;
import com.wang.springbootinit.service.QuestionService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 教师端-答题数据管理
 */
@RestController
@RequestMapping("/teacher/answer/data")
@Api(tags = "教师端-答题数据管理")
public class AnswerDataController {

    @Autowired
    private QuestionService questionService;


    /**
     * 练习题-答题数据管理
     * @param chapterId
     * @param questionType
     * @param questionCategory
     * @param current
     * @param pageSize
     * @param request
     * @return
     */
    @GetMapping("/test/page")
    public BaseResponse<Page<AnswerAnalyzeDataVO>> getAnswerTestDataPage(
            @RequestParam(required = false) Long chapterId,
            @RequestParam(required = false) Integer questionType,
            @RequestParam(required = false) Integer questionCategory,
            @RequestParam(required = false) Integer questionId,
            @RequestParam(defaultValue = "1") long current,
            @RequestParam(defaultValue = "10") long pageSize,
            HttpServletRequest request) {
        return ResultUtils.success(questionService.getAnswerTestDataPage(chapterId, questionType, questionCategory, questionId,current, pageSize,request));
    }

}
